package com.ljx.thread.pollThread07;

import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author LJX
 * @Description: TODO
 * @Date: 2022/11/2 20:07
 * @Version 1.0
 */
public class ConnectionThread01 {
	public static void main(String[] args) {
		ArrayList<Object> arrayList = new ArrayList<>();
		ExecutorService executorService = Executors.newFixedThreadPool(3);
		for (int i = 0; i < 30; i++) {
			int a=i;
			executorService.submit(new Runnable() {
				@Override
				public void run() {
					arrayList.add(Thread.currentThread().getName()+"~~~~~~~~~~~~~"+a);
					System.out.println(arrayList);
				}
			});
		}
		executorService.shutdown();

	}
}
